/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package service;

import models.User;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.AnnotationConfiguration;

/**
 *
 * @author Aster
 */
public class HibernateUtil {
    
        private static SessionFactory sessionFactory;

    static {
        sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
    }

    public HibernateUtil() {
    }

    public static Session openSession() {
        return sessionFactory.openSession();
    }

    public static void close() {
        sessionFactory.close();
    }
    
    public SessionFactory getSessionFactory() {
        return sessionFactory;
    }
}